package com.sob.bountyhunter;

import java.awt.Point;

public class Util {
	public static boolean DEBUG_MESSAGES=true;
	
	public static float anguloEntre(float x1, float y1, float x2, float y2 ){
		
		float a=(float) Math.toDegrees( Math.atan2(y2-y1, x2-x1) );
		//if(a<0) a=180+(180-Math.abs(a));
		
		return a;
	}
	
	public static float limtAngulo(float angle){
		float res=angle;
		
		if(angle<0){
			res=360-(Math.abs(angle));
		}
		
		return res;
	}
	
	public static void printDebug(String s){
		if(DEBUG_MESSAGES){
			System.out.println(s);
		}
	}
	
	public static double[] translatePos(float px, float py, float dist, float angulo){
		double[] res=new double[2];
		
		
		res[0]=px+Math.cos(Math.toRadians(angulo))*dist;
		res[1]=py+Math.sin(Math.toRadians(angulo))*dist;
		
		return res;
	}
}
